﻿// Copyright (c) Inossem. All rights reserved.
// Licensed under the LGPL-3.0 license. See LICENSE file in the project root for full license information.
using DWF.Common.Activities.Contract;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DWF.Studio.RemoteCtrls.Services
{
    public class ActivityService : IActivityService
    {
        public Action<string, string> _activityNotice = null;

        private Func<Dictionary<string, string>> _projectPropertiesFunc = null;

        public ActivityService(Func<Dictionary<string, string>> projectPropertiesFunc, Action<string, string> activityNotice)
        {
            _activityNotice = activityNotice;
            _projectPropertiesFunc = projectPropertiesFunc;
        }

        public string GetProjectPath()
        {
            var projectProperties = _projectPropertiesFunc();
            return projectProperties["projectDirectory"]; ;
        }

        public void Notice(string msg, string data)
        {
            if (_activityNotice != null)
            {
                _activityNotice(msg, data);
            }
        }

        public string GetProjectId()
        {
            var projectProperties = _projectPropertiesFunc();
            return projectProperties["projectId"];
        }
    }
}
